import { Service, Inject } from 'typedi';
import { res } from '@/utils/jsonResult';
import { MenuService } from '../MenuService';
import { Menu } from '@/entity/Menu';
import { MenuDao } from '@/dao/MenuDao';
import { addMenuParams } from '@/model/request/Menu';
import { Token } from '@/m_req/Token'

@Service()
export class MenuServiceImpl implements MenuService {

    @Inject()
    menuDao!: MenuDao

    async GetAllMenu(): Promise<res<Menu[]>> {
        return this.menuDao.GetAllMenuDao();
    }

    async addMenu(params: addMenuParams): Promise<res<null>> {
        return this.menuDao.addMenuDao(params);
    }

    async Menuupdata(params: addMenuParams): Promise<res<null>> {
        return this.menuDao.Menuupdata(params);
    }
    
    async deleteMenu(params: {id:number}): Promise<res<null>> {
        return this.menuDao.deleteMenuDao(params);
    } 

    async Menusions(token: Token): Promise<res<null>> {
        return this.menuDao.Menusions(token);
    }
}